package com.openness.example.lock;

import java.io.IOException;

import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.ZooDefs.Ids;

/**
 * @author Rain
 * @version 2013-5-21 上午11:11:31
 */

public class ZooKeeperMain {

	public static void main(String[] args) throws IOException,
			InterruptedException, KeeperException {
		ZooKeeper zk = new ZooKeeper("192.168.30.222:2181", 3000, null);
		
		System.out.println(zk.getChildren("/", false));

		zk.create("/lock", "".getBytes(), Ids.OPEN_ACL_UNSAFE,
				CreateMode.PERSISTENT);

		zk.close();
	}

}
